<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>编辑下载规则</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>


<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">


  <div class="layui-form-item">
    <label class="layui-form-label">添加类型</label>
    <div class="layui-input-block">
      <input type="radio" name="add_type" value="1" title="覆盖">
      <input type="radio" name="add_type" value="2" title="新增">
    </div>
  </div>

  <div class="layui-form-item" pane="">
    <label class="layui-form-label">人群类型</label>
    <div class="layui-input-block">
      <input type="radio" name="novel_type" value="1" title="广告线上">
      <input type="radio" name="novel_type" value="2" title="屏蔽地区">
    </div>
  </div>


  <div class="layui-form-item">
    <label class="layui-form-label">选择代理商</label>
    <div class="layui-input-block">
      <input type="checkbox"  title="全选" lay-skin="primary" lay-filter="qx">
      <input type="checkbox" name="quick_apps[]" value="0" title="分销平台" lay-skin="primary" checked>
      {foreach $agents as $vo}
      <input type="checkbox" name="quick_apps[]" value="{$vo.id}" title="{$vo.account}【{$vo.remarks}】" lay-skin="primary" checked>
      {/foreach}
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">所属频道</label>
    <div class="layui-input-block">
      <input type="checkbox" name="freq_ids[]" value="0" title="无区分">
      <input type="checkbox" name="freq_ids[]" value="1" title="男频">
      <input type="checkbox" name="freq_ids[]" value="2" title="女频">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">所属推荐位</label>
    <div class="layui-input-block">
      <input type="checkbox"  title="全选" lay-skin="primary" lay-filter="qx2">
      {foreach $titles as $vo}
      <input type="checkbox" name="recommend_titles[]" value="{$vo}" title="{$vo}" lay-skin="primary" checked>
      {/foreach}
    </div>
  </div>


  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">小说ID</label>
    <div class="layui-input-block">
      <textarea id="nIds" name="nIds" placeholder="请输入id，并用半角逗号分隔，如：1,2,3,4,5,6" class="layui-textarea"></textarea>
      <div class="layui-form-mid layui-word-aux">相同书籍类型下最多添加100本小说，如果超出，超出部分程序将不会添加</div>

    </div>
  </div>

  <div class="layui-form-item layui-hide">
    <button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
  </div>
</div>


<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
  layui.config({
    base: '/static/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
            ,form = layui.form
            ,admin = layui.admin;

    form.on('checkbox(qx)', function (data) {
      if (data.elem.checked === true) {
        $("input[name='quick_apps[]']").prop('checked', true);
      } else {
        $("input[name='quick_apps[]']").prop('checked', false);
      }
      form.render('checkbox');
    });

    form.on('checkbox(qx2)', function (data) {
      if (data.elem.checked === true) {
        $("input[name='recommend_titles[]']").prop('checked', true);
      } else {
        $("input[name='recommend_titles[]']").prop('checked', false);
      }
      form.render('checkbox');
    });

  });




</script>
</body>
</html>
